package com.yxd.demo.service;

import com.yxd.demo.domain.Coupon;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

/**
 * @author: yxd
 * @date: 2022/8/8 9:25
 */
@Service
public class CouponService {
    public List<Coupon> queryCouponList(String userId) {
        Coupon coupon1 = Coupon.builder()
                .id(1L)
                .name("满减券，满100减20")
                .threshold(BigDecimal.valueOf(100))
                .discountPrice(BigDecimal.valueOf(20))
                .type(2)
                .limit(2)
                .mutex(2)
                .build();
        Coupon coupon2 = Coupon.builder()
                .id(2L)
                .name("满减券，满200减50")
                .threshold(BigDecimal.valueOf(200))
                .discountPrice(BigDecimal.valueOf(50))
                .type(2)
                .limit(2)
                .mutex(1)
                .build();
        Coupon coupon3 = Coupon.builder()
                .id(3L)
                .name("满减券，满500减150")
                .threshold(BigDecimal.valueOf(500))
                .discountPrice(BigDecimal.valueOf(150))
                .type(2)
                .limit(2)
                .mutex(1)
                .build();
        Coupon coupon4 = Coupon.builder()
                .id(4L)
                .name("满减券，满1000减400")
                .threshold(BigDecimal.valueOf(1000))
                .discountPrice(BigDecimal.valueOf(400))
                .type(2)
                .limit(1)
                .productIdList(Arrays.asList(1L, 2L, 3L))
                .mutex(1)
                .build();
        Coupon coupon5 = Coupon.builder()
                .id(5L)
                .name("立减券，立减30")
                .discountPrice(BigDecimal.valueOf(30))
                .type(1)
                .limit(1)
                .productIdList(Arrays.asList(1L, 2L, 3L))
                .mutex(2)
                .build();
        Coupon coupon6 = Coupon.builder()
                .id(6L)
                .name("立减券，立减80")
                .discountPrice(BigDecimal.valueOf(80))
                .type(1)
                .limit(1)
                .productIdList(Arrays.asList(4L, 3L))
                .mutex(2)
                .build();
        Coupon coupon7 = Coupon.builder()
                .id(7L)
                .name("立减券，立减100")
                .discountPrice(BigDecimal.valueOf(100))
                .type(1)
                .limit(1)
                .productIdList(Arrays.asList(4L, 3L))
                .mutex(1)
                .build();
        return Arrays.asList(coupon1, coupon2, coupon3, coupon4, coupon5, coupon6, coupon7);
    }
}
